package models;

import java.util.ArrayList;

public class MajorStyleList {
	private static MajorStyleList instance;
	private ArrayList<MajorStyle>majorStyleList= new ArrayList<MajorStyle>();
	
    public static MajorStyleList getInstance() {
        if (null == instance) { 
            instance = new MajorStyleList();
        }
        return instance;
    }

	public void setMajorStyleList(ArrayList<MajorStyle> majorStyleList) {
		this.majorStyleList = majorStyleList;
	}

	public ArrayList<MajorStyle> getMajorStyleList() {
		return majorStyleList;
	}
	
	public void addMajorStyle(MajorStyle ms){
		majorStyleList.add(ms);
		
	}
	
	public MajorStyle getMajorStyleByName(String name){
		MajorStyle majorStyle=null;
		for(int i=0; i<majorStyleList.size(); i++){
			if(majorStyleList.get(i).getName().equals(name)){
				majorStyle=majorStyleList.get(i);
			}
		}
		return majorStyle;
	}
	
	public MajorStyle getMajorStyleById(int id){
		MajorStyle majorStyle=null;
		for(int i=0; i<majorStyleList.size(); i++){
			if(majorStyleList.get(i).getId() == id){
				majorStyle=majorStyleList.get(i);
				break;
			}
		}
		return majorStyle;
	}
    
    

}
